home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Best of MacTutor - S…e Code for Volumes 1 to 5
/
The Best of MacTutor - Source Code for Volume 1-5 (Wayzata Technology)(6031)(1990).bin
/
Source Code
/
#45 (Jun 89)
/
Forth Code
/
INIT runner
< prev
next >
Wrap
Text File
|
1989-04-16
|
951b
|
44 lines
\ INIT 12 starter
\ J. Langowski / MacTutor April 1989
\ Thanks to Eric Carrasco (Calvacom EC10) to this idea
\ which he implemented in Pascal
: $open-res { addr | refNum -- result }
addr call openresfile -> refNum
call ResError L_ext
dup not IF drop refNum THEN
;
: $close-res call CloseResFile call ResError L_ext ;
$4E714E71 CONSTANT nopnop
: runINIT { | refNum hINIT -- }
" theInit" $open-res -> refNum
refNum 0 > IF
ascii INIT 12 call GetResource -> hINIT
hINIT IF
hINIT call HomeResFile
refNum = IF
hINIT call DetachResource
hINIT @ execute \ run the INIT
nopnop hINIT @ ! \ fill first 2 words with NOPs
ELSE
" INIT not from my file" 0 0 0 call ParamText
1000 0 call NoteAlert drop
THEN
ELSE
" Can't find INIT 12 resource" 0 0 0 call ParamText
1000 0 call NoteAlert drop
THEN
ELSE
" Can't open file 'theINIT'" 0 0 0 call ParamText
1000 0 call NoteAlert drop
THEN
bye
;